package unit13;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;

public class Demo {
	public static void main(String[] args) {
		List<Integer> list=new ArrayList<>();
		list.add(54);
		list.add(46);
		list.add(76);
		list.add(234);
		list.add(1);
		Collections.sort(list);
		for(Integer s:list){
			System.out.println(s);
			
		}
	}
	public static <T extends Comparable> T max(Collection<T> c){
		if(c.isEmpty())throw new NoSuchElementException();
		Iterator<T> iter=c.iterator();
		T largest=iter.next();
		while(iter.hasNext()){
			T next=iter.next();
			if(largest.compareTo(next)<0)
				largest=next;
		}
		return largest;
	}
}
